import 'package:flutter/material.dart';

class DetailPage extends StatelessWidget {
  var id;
  var name;
  List links;

  DetailPage(data) {
    id = data['id'];
    name = data['name'];
    this.links = data['links'] as List;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('${name} 详情'),
      ),
      body: Center(
          child: GridView.builder(
              padding: EdgeInsets.all(0),
              gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
                  maxCrossAxisExtent: 180,
                  mainAxisSpacing: 0,
                  childAspectRatio: 1 //宽高比为2
                  ),
              itemCount: links.length,
              itemBuilder: (context, index) {
                var link = links[index];

                return Container(
                  padding: EdgeInsets.all(10),
                  child: Image.asset(
                    link,
                    fit: BoxFit.contain,
                  ),
                );
              })),
    );
  }
}
